﻿using System;
using System.Collections.Generic;
using System.Reflection;

namespace RockBus.Utilities
{
    public static class AssemblyExtensions
    {
        public static IEnumerable<Type> GetInterfaceImplementations<TInterface>(this Assembly assembly)
        {
            foreach (Type type in assembly.GetTypes())
            {
                Type itf = type.GetInterface(typeof(TInterface).Name);
                if (null != itf)
                {
                    yield return type;
                }
            }
        }
    }
}